package com.qfmy.common.utils;




import java.util.Random;
/**
 * @author 清风明月
 * @Package com.lzw.breezeNovel.common.utils
 * @date 2025/4/13
 * @description 生成随机数工具类
 */
@SuppressWarnings("all")
public class CodeUtils {

    /**
     * 生成指定长度的随机数->生成验证码
     * @param length
     * @return
     */
    public static String getCode(Integer length)
    {
        StringBuffer stringBuffer = new StringBuffer();
        Random random = new Random();
        for (int i = 0; i < length; i++) {
            stringBuffer.append(random.nextInt(10));
        }
        return stringBuffer.toString();
    }
}
